<?php
/*
 * 商品分类
 */
namespace Admin\Model;
use Think\Model;

/**
 * Guestbook模型
 */
class guestbookModel extends Model{
    
    protected $tableName = 'guestbook';

    /**
     * 自动完成
     * @var array
     */
    protected $_auto = array(
        
    );
    

    /*
     * 自动验证
     */
    protected $_validate = array(
        
     );
    
    
    /*
     * 添加
     */
    public function addGuestbook($data){
        $res = $this->add($data);
        return $res;
    }
    
    /*
     * 获取信息
     */
    public function getGuestbook($where){
        $res = $this->where($where)->find();
        return $res;
    }
    
    /*
     * 获取信息
     */
    public function getGuestbookLists($where=null){
        $res = $this->order("guestbook_id DESC")->where($where)->select();
        return $res;
    }
    
    /*
     * 获取信息
     */
    public function getGuestbookList($where,$page){
        $res = $this->order("guestbook_id DESC")->where($where)->page($page,C('PAGE_SIZE'))->select();
        return $res;
    }
    
	
    public function getGuestbookCount($where){
        $res = $this->where($where)->count();
        return $res;
    }
    
    
    /*
     * 编辑信息
     */
    public function editGuestbook($where,$data){
        return $this->where($where)->save($data);
    }

}
